package org.devocean.groupbuying.domain;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@SuppressWarnings("serial")
@Entity
public class Category implements Serializable {

	@Id
	@GeneratedValue
	private Integer categoryID;

	@Column(name = "NAME")
	private String name;

	@Column(name = "LANG")
	private String lang;

	@Column(name = "MODEL")
	private String model;

	@Column(columnDefinition = "TEXT")
	private String description;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parentID", referencedColumnName = "categoryID", nullable = true)
	private Category category;

	@OneToMany(cascade = CascadeType.REMOVE, mappedBy = "category")
	private Set<Category> categories = new HashSet<Category>();

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "categoriesLocalizationID", referencedColumnName = "categoriesLocalizationID", nullable = true)
	private CategoriesLocalization categoriesLocalization;

	public Integer getCategoryID() {
		return categoryID;
	}

	public void setCategoryID(Integer categoryID) {
		this.categoryID = categoryID;
	}

	public String getName() {
		return name;
	}

	public String getLang() {
		return lang;
	}

	public void setLang(String lang) {
		this.lang = lang;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	

	public CategoriesLocalization getCategoriesLocalization() {
		return categoriesLocalization;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setCategoriesLocalization(
			CategoriesLocalization categoriesLocalization) {
		this.categoriesLocalization = categoriesLocalization;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public Set<Category> getCategories() {
		return categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}

}
